package com.mbd.field;

/**
 * Клас, който обслужва JAVADOC
 * 
 * @author milena.bd@gmail.com
 */
public class Cell {

	private static final char EMPTY = ' ';

	private static final int HEIGHT = 5;

	private static final int WIDTH = 5;

	private Integer colNum = null;

	private char[][] content = null;

	private Integer rowNum = null;

	/**
	 * Конструктор
	 * 
	 * @param rowNum
	 * @param colNum
	 */
	public Cell(Integer rowNum, Integer colNum) {
		super();
		this.rowNum = rowNum;
		this.colNum = colNum;

		init();
	}

	public Integer getColNum() {
		return this.colNum;
	}

	public Integer getRowNum() {
		return this.rowNum;
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();

		for (char[] element : getContent()) {
			for (char element2 : element) {
				builder.append(element2);
			}
			builder.append("\n");
		}

		return builder.toString();
	}

	private char[][] getContent() {
		return this.content;
	}

	private void init() {
		this.content = new char[HEIGHT][WIDTH];

		for (int row = 0; row < HEIGHT; row++) {
			for (int col = 0; col < WIDTH; col++) {
				if (col == 0) {
					this.content[row][col] = '|';
				} else if (col == 0 && row == HEIGHT - 1 || row == HEIGHT - 1) {
					this.content[row][col] = '_';
				} else {
					this.content[row][col] = EMPTY;
				}
			}
		}
	}

}
